package com.matrix.java.chap_07.example;

import java.util.Scanner;

/*
    AnalyzeNumbers
 */
public class Case7_01 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the number of items: ");
        int arrNum = input.nextInt();
        double[] arr = new double[arrNum];
        double sum = 0;
        System.out.print("Enter the numbers: ");
        for (int i = 0; i < arr.length; i++) {
            arr[i]  = input.nextDouble();
            sum += arr[i];
        }
        input.close();
        double avg = sum / arrNum;
        System.out.println("Average is " + avg);
        int count = 0;
        for (double v : arr) {
            if (v > avg) {
                count++;
            }
        }
        System.out.println("Number of elements above the average is "+count);
    }
}
